package com.finance.rule.service;

import com.finance.rule.bean.pojo.MasterRule;
import com.finance.rule.dao.MasterRuleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: gly
 * @Date: Created in 2017-08-08
 */
@Service
public class MasterRuleService implements IMasterRuleService {
    @Autowired
    private MasterRuleMapper masterRuleMapper;
    @Override
    public Long add(MasterRule masterRule) {
       masterRuleMapper.add(masterRule);
       return  masterRule.getId();
    }

    @Override
    public boolean deleteMasterRule(String supplierCode, String carrierCode, String toProvince) {
        return masterRuleMapper.deleteMasterRule(supplierCode,carrierCode,toProvince)>0;
    }

    @Override
    public boolean deleteMasterRule(int calculateType){
        return masterRuleMapper.deleteMasterRuleAll(calculateType)>0;
    }

    @Override
    public Long masterRuleIsExist(String supplierCode, String carrierCode, String toProvince) {
        return masterRuleMapper.masterRuleIsExist(supplierCode,carrierCode,toProvince);
    }

}
